<form class="layui-form seller-form" action="">
    <div class="layui-tab">
        <ul class="layui-tab-title">
            <li><a href="{:url('tranShop')}">商户(总消费)</a></li>
            <li class="layui-this"><a href="{:url('tranShopUser')}" >商户(用户量)</a></li>
        </ul>
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
                <div class="layui-inline">
                    <div class="layui-input-inline seller-inline-3">
                        <input type="text" name="shop_name" lay-verify="title" placeholder="Shop Name" autocomplete="off"
                               class="layui-input">
                    </div>
                </div>
                <div class="layui-inline" style="padding-left: 5px;">
                    <select name="sort_type" >
                        <option value="1">消费总额</option>
                        <option value="2">拒付总额</option>
                        <option value="3">退款金额</option>
                        <option value="4">退款总数</option>
                    </select>
                </div>
                <div class="layui-inline" style="padding-left: 5px;">
                    <input type="text" name="datetime" id="datetime" placeholder="Start Time _ End Time" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-inline">
                    <div class="layui-input-block">
                        <button class="layui-btn layui-btn-sm" lay-submit lay-filter="*"><i class="iconfont icon-chaxun"></i>Search</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</form>

<div class="table-body">
    <table id="balanceTable" lay-filter="balanceTable"></table>
</div>
<script>
    layui.use(['form', 'table' ,'laydate'], function () {

        //时间插件
        layui.laydate.render({
            elem: '#datetime',
            range: '_',
            format: 'yyyy-MM-dd'
        });

        layui.table.render({
            elem: '#balanceTable',
            height: 'full-99',
            cellMinWidth: '80',
            totalRow: true,
            method: 'post',
            // toolbar: '#toolbar', //开启头部工具栏，并为其绑定左侧模板
            // defaultToolbar: ['exports'],
            url: "{:url('cards/tranShopUser')}",
            id: 'balanceTable',
            cols: [[
                { type: 'numbers'},
                { field: 'user', title: 'username',totalRowText:'Total Amount:'},
                { field: 'open_rate', title: '开卡费率',align: 'right'},
                { field: 'fund_rate', title: '充值费率',align: 'right'},
                { field: 'credit_rate', title: '退款费率',align: 'right'},
                { field: 'card_num', align: 'right', title: '开卡总数' , totalRow: true},
                { field: 'amount', align: 'right', title: '消费总额' ,style:'color:#FF5722;font-weight:bold' , totalRow: true},
                { field: 'num', align: 'right', title: '消费出现笔数' , totalRow: true},
                { field: 'user_balance', align: 'right', title: '用户总余额' ,style:'color:#FF5722;font-weight:bold' ,  totalRow: true},
                { field: 'card_balance', align: 'right', title: '卡总余额' ,style:'color:#FF5722;font-weight:bold' ,  totalRow: true},
                { field: 'fund_amount', align: 'right', title: '充值总金额' ,style:'color:#FF5722;font-weight:bold' ,  totalRow: true},
                { field: 'dec_amount', align: 'right', title: '拒付总额' ,style:'color:#FF5722;font-weight:bold' ,  totalRow: true},
                { field: 'dec_num', align: 'right', title: '拒付出现笔数' ,  totalRow: true},
                { field: 'credit_amount', align: 'right', title: '实际退款金额' ,  totalRow: true},
                { field: 'credit_num', align: 'right', title: '实际退款笔数' ,  totalRow: true},
            ]],
            page: true,
            limit: 10000,
            limits: [10000],
        });
        layui.form.on('submit(*)', function (data) {
            layui.table.reload('balanceTable', {
                where: data.field
                , page: {
                    curr: 1 //重新从第 1 页开始
                }
            });
            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });
    });
</script>